<template>
  <view class="order margin-bottom-10">
    <view class="createdAt color-2c">
      {{ items.createdAt }}
      <view v-if="items.confirm === '0'">等待商家确认订单</view>
      <view v-if="items.confirm === '1'">等待配送</view>
      <view v-if="items.confirm === '2'">配送中</view>
      <view v-if="items.confirm === '3'">已完成</view>
    </view>
    <scroll-view scroll-y="true" class="orderScoll margin-bottom-10" v-if="(items.orderlist.length > 1)">
      <view v-for="(item) in items.orderlist" :key="item.id">
        <cart-item :item="item" :showCheck="false" :showEdit="false"></cart-item>
      </view>
    </scroll-view>
    <view v-for="(item) in items.orderlist" :key="item.id" class="orderOne" v-else>
      <cart-item :item="item" :showCheck="false" :showEdit="false"></cart-item>
    </view>
     <view class="flex justify-between">
        <view class="">共{{items.allNum}}件商品</view>
         <view class="color-2c f16">￥合计：{{items.allPrice}}</view>
      </view>

    <view v-if="items.confirm == '100'" class="goPlay" @click="goPlay">去付款...</view>
  </view>
</template>

<script>
  import cartItem from '@/components/cart-item.vue'
  export default {
    props: ['items'],
    components: {
      "cart-item": cartItem
    },
    data() {
      return {}
    },
    methods: {
      goPlay() {
        console.log(this.items);
        this.$store.commit('cart/orderAdd', this.items)
        this.$store.commit('address/orderAdd', this.items)
        uni.navigateTo({
          url: `/pagesA/order/order`
        })
        this.$store.commit('cart/orderRemove')
      }
    },

  }
</script>

<style lang="scss" scoped>
  .orderScoll{
    height: 300rpx;
  }

  .order {
    .createdAt {
      margin: 10rpx 5px;
      display: flex;
      justify-content: space-between;
    }

    .goPlay {
      font-size: 20rpx;
      display: inline-block;
      padding: 5rpx 15rpx;
      margin: 10rpx;
      border: #b0b0b0 1px solid;
      margin-right: 80%;
      position: relative;
      left: 81%;
      border-radius: 10rpx;
    }
  }
</style>
